package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Controller
public class controller {

    @GetMapping("hello")
    public String hello(Map map){

        map.put("username","tom");
        map.put("birthday",new Date());
        map.put("sex","男");
        map.put("data",new HashMap<String,String>(){{
            put("张三","男");
            put("李四","女");
            put("王五","男");
        }});

        return "hello";
    }

    @ResponseBody
    @GetMapping("hello/{id}")
    public int bzd(@PathVariable int id){
        System.out.println(id);
        return id;
    }

}
